<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="template::head">

</head>
<body class="hold-transition skin-red layout-top-nav" ng-app="pls">
<div class="wrapper">
    <navigation th:include="template::header">

    </navigation>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">

        <section class="content-header">
            <h1>
                <span>任务细节管理</span>
            </h1>
        </section>

        <!-- Main content -->
        <section class="content">
            <!-- Your Page Content Here -->
            <div class="row" ng-controller="fzldInterfaceTaskDetailsController">
                <div class="col-xs-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title" th:text="信息">信息</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body">
                            <div class='row'>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_name" class="control-label">任务类型</label>
                                        <input entersearch="true" type="text" id="idSearch_name" ng-model="iem.taskType" class="form-control"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskType" class="control-label">描述</label>
                                        <input entersearch="true" type="text" id="idSearch_taskType" ng-model="iem.description" class="form-control" />
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">中间表</label>
                                        <input entersearch="true" type="text" id="idSearch_taskSource" ng-model="iem.tcWbeFile" class="form-control"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">中间表备份</label>
                                        <input entersearch="true" type="text" id="idSearch_taskSourceb" ng-model="iem.tcWbeFileB" class="form-control"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">发起方</label>
                                        <input entersearch="true" type="text" id="哦" ng-model="iem.originator" class="form-control" th:placeholder="无"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">接口函数</label>
                                        <input entersearch="true" type="text" id="啊" ng-model="iem.wmsWbeFile" class="form-control" th:placeholder="无"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">WMS对应表</label>
                                        <input entersearch="true" type="text" id="wb" ng-model="iem.interfaceFunction" class="form-control" th:placeholder="无"/>
                                    </div>
                                </div>
                                <div class='col-md-3'>
                                    <div class="form-group">
                                        <label for="idSearch_taskSource" class="control-label">备注</label>
                                        <input entersearch="true" type="text" id="b" ng-model="iem.remarks" class="form-control" th:placeholder="无"/>
                                    </div>
                                </div>
                                <div class="form-group" style="width: 98.5%; margin-left: auto; margin-right: auto;" >
                                    <label for="idExistProblem" class="control-label">存在问题</label>
                                    <textarea  style="height: 100px" id="idExistProblem" class="form-control" ng-model="iem.existProblem" rows="3"></textarea>
                                </div>

                                <div class="form-group" style="width: 98.5%; margin-left: auto; margin-right: auto;">
                                    <label for="idExistProblem" class="control-label">说明</label>
                                    <textarea  style="height: 100px"  id="idInstruction" class="form-control" ng-model="iem.instruction" rows="3" th:placeholder="无"></textarea>
                                </div>
                                <div class="form-group" style="width: 98.5%; margin-left: auto; margin-right: auto;">
                                    <label for="idConversionRule" class="control-label"  th:placeholder="无">转换规则</label>
                                    <textarea style="height: 100px" id="idConversionRule" ng-model="iem.conversionRule" class="form-control" rows="3"></textarea>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer" id="add">
                            <button class="btn btn-success"
                                    th:text="保存"
                                    ng-click="saveItem($event)"></button>
                            <button class="btn btn-info"
                                    th:text="新增"
                                    ng-click="openDetail(null,$event)"></button>
                        </div>
                        <div class="box-body">
                            <table id="tableResult" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                     <th class="sorting">
                                            <span th:text="字段编号"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="字段描述"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="字段类型"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="字段长度"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="对应ERP字段"></span>
                                    </th>
                                    <th class="sorting" style="width: 200px">
                                        <span th:text="备注"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="WMS表名"></span>
                                    </th>
                                    <!--<th class="sorting">
                                        <span th:text="WMS字段描述"></span>
                                    </th>-->
                                    <th class="sorting">
                                        <span th:text="WMS字段名称"></span>
                                    </th><th class="sorting">
                                        <span th:text="WMS字段类型"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="WMS字段长度"></span>
                                    </th>
                                    <th class="sorting" style="width: 200px">
                                        <span th:text="WMS备注"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="验证规则"></span>
                                    </th>
                                    <th class="sorting">
                                        <span th:text="编辑"></span>
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="item in task_details">
                                        <td>
                                            <a href="javascript:void(0)" ng-click="openDetail(item,$event)">{{item.tcFieldCode}}</a>
                                        </td>
                                        <td>
                                            {{item.tcFieldDescription}}
                                        </td>
                                        <td>{{item.tcFieldType}}</td>
                                        <td>{{item.tcFieldLength}}</td>
                                        <td>
                                            {{item.tcFieldErp}}
                                        </td>
                                        <td>
                                            {{item.tcFieldRemarks}}
                                        </td>

                                        <td>
                                            {{item.wmsTableName}}
                                        </td>
                                       <!-- <td>
                                            {{item.wmsFieldDescription}}
                                        </td>-->
                                        <td>
                                            {{item.wmsFieldName}}
                                        </td>
                                        <td>
                                            {{item.wmsFieldType}}
                                        </td>
                                        <td>
                                            {{item.wmsFieldLength}}
                                        </td>
                                        <td>
                                            {{item.wmsFieldRemarks}}
                                        </td>
                                        <td>
                                            {{item.checkRule}}
                                        </td>
                                        <td>
                                            <button class="btn btn-danger"
                                                    ng-click="delTask(item,$event)">删除
                                            </button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!-- /.box -->
                </div>
                <div class="modal fade" id="edtModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document" style="width: 50%;height: 80%;">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel3" th:text="#{common.addOrUpdate}"></h4>
                            </div>
                            <div class="modal-body">
                                <div class="tab-content">
                                    <div class="row form form-horizontal">
                                        <div class="form-group" ng-class="{'has-error' : !addCheck(), 'has-success' : addCheck()}">
                                            <label for="id_tcFieldCode" class="col-xs-2 control-label" th:text="字段编号"></label>
                                            <div class="col-xs-6">
                                                <input id="id_tcFieldCode" type="text" class="form-control" ng-model="current.tcFieldCode" />
                                            </div>
                                            <span class="help-block" ng-show="!addCheck()" th:text="字段编号不能为空"></span>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_tcFieldDescripti" class="col-xs-2 control-label" th:text="字段描述"></label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_tcFieldDescripti" ng-model="current.tcFieldDescription" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_tcFieldType" class="col-xs-2 control-label" th:text="字段类型"></label>
                                            <div class="col-xs-6">
                                                <input type="text"  id="id_tcFieldType" ng-model="current.tcFieldType" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_tcFieldLength" class="col-xs-2 control-label" th:text="字段长度"></label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_tcFieldLength" ng-model="current.tcFieldLength" class="form-control" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_tcFieldErp" class="col-xs-2 control-label" th:text="对应ERP字段"></label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_tcFieldErp" ng-model="current.tcFieldErp" class="form-control" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_tcFieldRemarks" class="col-xs-2 control-label" th:text="备注">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_tcFieldRemarks" ng-model="current.tcFieldRemarks" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_wmsTableName" class="col-xs-2 control-label" th:text="WMS表名">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_wmsTableName" ng-model="current.wmsTableName" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_wmsFieldName" class="col-xs-2 control-label" th:text="WMS字段名称">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_wmsFieldName" ng-model="current.wmsFieldName" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_wmsFieldType" class="col-xs-2 control-label" th:text="WMS字段类型">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_wmsFieldType" ng-model="current.wmsFieldType" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_wmsFieldLength" class="col-xs-2 control-label" th:text="WMS字段长度">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_wmsFieldLength" ng-model="current.wmsFieldLength" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_wmsFieldRemarks" class="col-xs-2 control-label" th:text="WMS备注">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_wmsFieldRemarks" ng-model="current.wmsFieldRemarks" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="id_orderSaleNo" class="col-xs-2 control-label" th:text="验证规则">quantity</label>
                                            <div class="col-xs-6">
                                                <input type="text" id="id_orderSaleNo" ng-model="current.checkRule" class="form-control"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal" th:text="#{action.close}"></button>
                                <button type="button" class="btn btn-primary"  th:text="#{action.confirm}" ng-click="saveDetail($event);"></button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <navigation th:include="template::footer">

    </navigation>


</div>
<!-- ./wrapper -->






<navigation th:include="template::js">

</navigation>
<script th:inline="javascript">

    /*<![CDATA[*/
    angular.module("pls").controller("fzldInterfaceTaskDetailsController", function($scope, httpService, Message, $timeout, $rootScope) {
        $scope.task_details =[[${list}]];
        $scope.iem = [[${iem}]];
        $scope.current = {manageId : $scope.iem.id};
        $scope.saveItem=function(event){
            httpService("/excelManage/header/add",$scope.iem,function(json){

                if (json.msg == "success")
                {
                    swal('修改成功');
                    angular.element("#edtproduction_planModal").modal('hide');
                    $scope.errorMsg = "";
                }
                else
                    $scope.errorMsg = json.msg;
                    swal(json.msg);
            })
        }
        $scope.saveDetail = function () {
            if (!$scope.addCheck()) return;
            httpService("/excelManage/details/add",$scope.current,function(json){

                if (json.msg == "success")
                {
                    angular.element("#edtModal").modal('hide');
                    $scope.loadItems();
                    $scope.errorMsg = "";
                }
                else if (json.msg == "exit"){
                    swal("字段编号已存在！");
                }else{
                    $scope.errorMsg = json.msg;
                }
            })
        }
        $scope.loadItems = function(){
            httpService("/excelManage/details/listByHeader",{id : $scope.iem.id},function(json){
                $scope.task_details = json;
            });
        }
        $scope.openDetail = function (item,event) {
            if (item){
               $scope.current = $.extend(true, {}, item);
            }else{
                $scope.current = {manageId : $scope.iem.id};
            }
            angular.element("#edtModal").modal("show");
        }
        $scope.addCheck = function () {
            return   $scope.current.tcFieldCode;
        }
        $scope.delTask = function (item,event) {
            httpService("/excelManage/details/remove", {id:item.id},function(json) {
                $scope.loadItems();
            });
        }
        $scope.init = function() {
        }
        $scope.init();
    });
    /*]]>*/
</script>
</body>
</html>